//
//  ProtocolController.swift
//  one
//
//  Created by huangfeng on 2018/5/7.
//  Copyright © 2018年 huangfeng. All rights reserved.
//

import UIKit

protocol Greetable {
    var name: String { get }
    func greet()
}


class Animal {
    var leg: Int { return 2 }
    func eat() {
        print("eat food.")
    }
    func run() {
        print("run with \(leg) legs")
    }
}

class Tiger: Animal {
    override var leg: Int { return 4 }
    override func eat() {
        print("eat meat.")
    }
}

struct PPerson: Greetable {
    let name: String
    func greet() {
        print("你好 \(name)")
    }
}

class ProtocolController: UIViewController {


    
    override func viewDidLoad() {
        super.viewDidLoad()

        let tiger = Tiger()
        tiger.eat()
        tiger.run()
        
        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
